package com.fx.common.domain;


import lombok.Data;

import java.io.Serializable;

@Data
public class R <T> implements Serializable {

    private String code;

    private String message;

    private T data;

    public R(){}

    public R(String code, String message) {
        this.code = code;
        this.message = message;
    }

    public R(T data) {
        this("0000","success");
        this.data = data;
    }

    public static R fail(String code, String message){
        return new R(code,message);
    }

    public static <T> R success(T data){
        return new R(data);
    }
}
